setLocusContext

open fun setLocusContext(@NonNull activity: Activity, @Nullable locusId: LocusIdCompat, @Nullable bundle: Bundle)(source)

Sets the LocusIdCompat for this activity. The locus id helps identify different instances of the same Activity class.

For example, a locus id based on a specific conversation could be set on a conversation app's chat Activity. The system can then use this locus id along with app's contents to provide ranking signals in various UI surfaces including sharing, notifications, shortcuts and so on.

It is recommended to set the same locus id in the shortcut's locus id using setLocusId so that the system can learn appropriate ranking signals linking the activity's locus id with the matching shortcut.

Parameters

activity

activity for which to set locus id.

locusId

a unique, stable id that identifies this Activity instance. LocusId is an opaque ID that links this Activity's state to different Android concepts: setLocusId. LocusID is null by default or if you explicitly reset it.

bundle

extras set or updated as part of this locus context. This may help provide additional metadata such as URLs, conversation participants specific to this Activity's context. Bundle can be null if additional metadata is not needed. Bundle should always be null for null locusId.

See also

Compatibility behavior:

  • API 30 and above, this method matches platform behavior.
  • API 29 and earlier, this method is no-op.